var indexRouter = require('./index');
var usersRouter = require('./users');
var loginRouter = require('./login');
var logoutRouter = require('./logout');
var registerRouter = require('./register');
var submitArticlesRouter = require('./submitArticles');
var queryArticlesRouter = require('./queryArticles');
var deleteArticlesRouter = require('./deleteArticles');
var modifyPwdRouter = require('./modifyPwd');
var commentRouter = require('./comment');

module.exports = function(app){
    //设置跨域访问  
    // app.all('*', function(req, res, next) {  
    //     res.header("Access-Control-Allow-Origin", "*");  
    //     res.header("Access-Control-Allow-Headers", "X-Requested-With");  
    //     res.header("Access-Control-Allow-Methods", "PUT,POST,GET,DELETE,OPTIONS");  
    //     res.header("X-Powered-By", ' 3.2.1');  
    //     res.header("Content-Type", "application/json;charset=utf-8");  
    //     next();  
    //   });  
    
    app.use('/', indexRouter);
    app.use('/users', usersRouter);
    app.use('/login', loginRouter);
    app.use('/logout', logoutRouter);
    app.use('/register', registerRouter);
    app.use('/submitArticles', submitArticlesRouter);
    app.use('/queryArticles', queryArticlesRouter);
    app.use('/deleteArticles', deleteArticlesRouter);
    app.use('/modifyPwd', modifyPwdRouter);
    app.use('/comment', commentRouter);
}
